package cn.xd.base.controller.admin;

import cn.xd.base.application.service.query.AdminUserQueryAppService;
import cn.xd.base.domain.bean.response.AdminOrgDTO;
import cn.xd.common.response.ResponseResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 公开的接口
 */
@RestController
@RequestMapping("/public/api/admin")
public class PublicAdminController {
    @Resource
    private AdminUserQueryAppService adminUserQueryAppService;

    /**
     * 通过账号查询机构
     *
     * @param account
     * @return
     */
    @PostMapping("/getOrgs/{account}")
    public ResponseResult<List<AdminOrgDTO>> getOrgByAccount(@PathVariable String account) {
        return ResponseResult.success(adminUserQueryAppService.getOrgByAccount(account));
    }
}
